# Contributor: Alex McGrath <amk@amk.ie>
# Maintainer: Alex McGrath <amk@amk.ie>
pkgname=gonic
pkgver=0.10.0
pkgrel=0
pkgdesc="Subsonic compatible music streaming server"
url="https://github.com/sentriz/gonic"
arch="all !mips !mips64" # go is missing
license="GPL-3.0-or-later"
subpackages="$pkgname-openrc"
depends="ffmpeg sqlite"
makedepends="binutils-gold go alsa-lib-dev taglib-dev"
install="$pkgname.pre-install"
source="
	gonic.initd
	gonic.confd
	gonic-$pkgver.tar.gz::https://github.com/sentriz/gonic/archive/v$pkgver.tar.gz
	"
export GOPATH="$srcdir"
export GO111MODULES=on

build() {
	./_do_build_server
}

check() {
	go test ./...
}

package() {
	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname
	install -Dm755 "$builddir"/"$pkgname" \
		"$pkgdir"/usr/bin/"$pkgname"

}

cleanup_srcdir() {
	go clean -modcache
	default_cleanup_srcdir
}


sha512sums="9d571f9980b30c665e051cc0d43e71e7029c473049d0e078d84ff2c001a953b9eebc95b7d45f651d4180a37f29976cc775fa756da1661296d58eb46501901f33  gonic.initd
473691065ab718c343483cdeca07f9d3254974f681bdbb413a0e618b3dd4fbc089d07107093a482188f11a0a41e48b84ccc7b52a99e57fd60fbb40339f5ffd2e  gonic.confd
f0c925a6bbe92ee23b8a2922c5697d596ca1abffab9e76d15930d15cea828ae7de8cf9ff3a11a151980a9b3455ff314c1129777f277213fbd977ccc9c9a6d9bf  gonic-0.10.0.tar.gz"
